<%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 2018/1/10
  Time: 14:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--解析表达式--%>
<%@ page isELIgnored="false" %>
<%--引入jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>公司导航</title>
</head>

<body>
<nav class="navbar navbar-bottom" role="navigation">

    <div id="two">
        <div>
            <img src="${pageContext.request.contextPath}/dist/foreEnd3/img/LOGO1.png" alt="" class="alllogo">
            <ul class="nav nav_2">
                <li>
                    <a href="${pageContext.request.contextPath}/view/foreEnd3/zpc_company_home.html" class="sim-button button01"><span data-hover="公司首页">&nbsp;公司首页&nbsp;</span></a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/CompanyInfo/selCompanyInfo.do" class="sim-button button01"><span data-hover="企业信息管理">&nbsp;企业信息管理&nbsp;</span></a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/Postion/forPublish.do" class="sim-button button01"><span data-hover="发职位">&nbsp;发职位&nbsp;</span></a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/Resume/selResumeByConditions.do" class="sim-button button01"><span data-hover="找简历">&nbsp;找简历&nbsp;</span></a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/view/foreEnd3/zpc_position_management.html" class="sim-button button01"><span
                            data-hover="职位管理">&nbsp;职位管理&nbsp;</span></a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/view/foreEnd3/zpc_resume_manage.html" class="sim-button button01"><span data-hover="简历管理">&nbsp;简历管理&nbsp;</span></a>
                </li>
            </ul>
            <ul class="nav nav_1">
                <c:choose>
                    <c:when test="${userLogin!=undefined}">
                        <a href="" style="">
                            <li class="login1">

                                <c:choose>
                                    <c:when test="${userLogin.loginType == 0 && userLogin.member.memberPicture != undefined}">
                                        <img src="${pageContext.request.contextPath}/uploadImg/${company.licence}"
                                             alt="" class="allheader">
                                    </c:when>
                                    <c:when test="${userLogin.loginType == 1 && userLogin.company.companyPicture != undefined}">
                                        <img src="${pageContext.request.contextPath}/uploadImg/${userLogin.company.companyPicture}"
                                             alt="" class="allheader">
                                    </c:when>
                                    <c:otherwise>
                                        <img src="${pageContext.request.contextPath}/dist/foreEnd3/img/tou.png" alt=""
                                             class="allheader">
                                    </c:otherwise>
                                </c:choose>
                                <span id="newMsg"
                                      style="width: 5px;height: 5px;background-color: red;display:none;border-radius: 50px;position: absolute;top: 19px;left: 70px "></span>
                                <ul class="head-menu">
                                    <li class="head_new2">
                                        <span class="fa fa-user"
                                              style="color: #666;float: left;font-size: 16px;margin-right: 5px;line-height: 22px"></span>
                                        <span style="float: left">
                                            <c:if test="${userLogin.loginType == 0}">
                                                <a href="${pageContext.request.contextPath}/Member/selMemberInfo.do"
                                                   class="head_name">${userLogin.loginCount}</a>
                                            </c:if>
                                            <c:if test="${userLogin.loginType == 1}">
                                                <a href="${pageContext.request.contextPath}/CompanyInfo/selCompanyName.do"
                                                   class="head_name">${userLogin.loginCount}</a>
                                            </c:if>
                                        </span>
                                        <span style="float: right"><a
                                                href="${pageContext.request.contextPath}/XzLogin/ExitUser.do">注销</a></span>
                                        <span style="float: right;margin-right: 5px"><a
                                                href="${pageContext.request.contextPath}/xzMsg/selMsgAll.do"
                                                class="fa fa-envelope" style="color: #fc6866"> (<span
                                                id="noread">0</span>)</a></span>
                                    </li>
                                    <li><span class="head_new"></span><a
                                            href="${pageContext.request.contextPath}/zp_index">招聘中心</a></li>
                                    <li><span class="head_new"></span><a
                                            href="${pageContext.request.contextPath}/view/foreEnd3/safe.html">账号安全</a>
                                    </li>
                                </ul>
                            </li>
                        </a>
                    </c:when>
                    <c:otherwise>
                        <li class="register1">
                            <a href="#0" class="allregister" style="margin-top: 13px"><span>注册</span></a>
                        </li>
                        <li class="login1">
                            <a href="${pageContext.request.contextPath}/view/foreEnd3/login.html"
                               style="margin-top: 13px"><span>登录</span></a>
                        </li>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div>
    </div>
</nav>
<jsp:include page="registerall.jsp"/>


</body>
<script>
    $(function () {
        if (${userLogin==null}) {
            if (getCookie("cookieToken") != null) {
                $.ajax({
                    url: '${pageContext.request.contextPath}/XzLogin/LoginCookie.do',
                    data: {cookieToken: getCookie("cookieToken")},
                    success: function (data) {
                        if (data.msg == "ok") {
                            window.location.reload();
                        }
                    }
                });
            }
        } else {
            $.ajax({
                url: '${pageContext.request.contextPath}/xzMsg/noRaadCount.do',
                success: function (data) {
                    console.log(data.count);
                    if (data.count > 0) {
                        $('#newMsg').show();
                        $('#noread').text(data.count);
                    } else {
                        $('#newMsg').hide();
                        $('#noread').text("0");
                    }
                    setInterval(function () {
                        $.ajax({
                            url: '${pageContext.request.contextPath}/xzMsg/noRaadCount.do',
                            success: function (data) {
                                console.log(data.count);
                                if (data.count > 0) {
                                    $('#newMsg').show();
                                    $('#noread').text(data.count);
                                } else {
                                    $('#newMsg').hide();
                                    $('#noread').text("0");
                                }
                            }
                        });
                    }, 10000);
                }
            });
        }
    })
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg))
            return arr[2];
        else
            return null;
    }
</script>
</html>
